<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
$this->registerJsFile('@web/js/setHeight.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/js/writequestion.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/uediter/ueditor.config.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJsFile('@web/uediter/ueditor.all.min.js',['depends'=>['app\assets\AppAsset']]);
/* @var $this yii\web\View */
/* @var $model app\models\WriteQuestion */
/* @var $form yii\widgets\ActiveForm */
$content = str_replace('"',"'",$model->reading_content);
$content = str_replace("\n", "", $content);
$content = str_replace("\r", "", $content);
$content1 = str_replace('"',"'",$model->hearing_content);
$content1 = str_replace("\n", "", $content1);
$content1 = str_replace("\r", "", $content1);
?>
<script>
    var c1 = <?php echo $model->class1_id?$model->class1_id:"false" ?>;
    var c2 = <?php echo $model->class2_id?$model->class2_id:"false" ?>;
    var c3 = "<?php echo $model->url?$model->url:'false' ?>";
    var c4 = "<?php if(isset($id)){echo $id;}else{echo 'false';} ?>";
    var c5 = "<?php echo $model->index_img_url?$model->index_img_url:'false' ?>";
    var c6 = "<?php echo $content?$content:"false" ?>";
    var c7 = "<?php echo $content1?$content1:"false" ?>";
    var c8 = "<?php echo $model->class_name?$model->class_name:"false" ?>";
    var h = "<?php echo $model->id ?>";
</script>
<div class="box" style="font-size: 15px">
<div class="write-question-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'tnum')->textInput() ?>
    <?= $form->field($model, 'class1_id')->dropDownList(["0"=>"请选择"]) ?>

    <?= $form->field($model, 'class2_id')->dropDownList(["0"=>"请选择"]) ?>

    <?= $form->field($model, 'class_num')->textInput() ?>

    <?= $form->field($model, 'class_name')->dropDownList(["0"=>"请选择","综合写作"=>"综合写作","独立写作"=>"独立写作"]) ?>

    <?= $form->field($model, 'info')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'question')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'reading_content')->textarea(['rows' => 6]) ?>
    <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>

    <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
    <div id="urlll">
    <?php if (!$model->id){ ?>
    <a href="javascript:;" id="url" onClick="javascript:window.alert('请到修改处上传文件')">上传音频</a>
    <?php }else{ ?>
    <a href="javascript:;" id="url1" onClick="javascript:window.open('./?r=upload/qiniu&class=write_question-url-<?= $model->id ?>','','width=600,height=500,left=10, top=10,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;">修改音频</a>
    <?php } ?>
    </div>
    <?= $form->field($model, 'hearing_content')->textarea(['rows' => 6]) ?>
    <script id="editor1" type="text/plain" style="width:1024px;height:500px;"></script>

    <?= $form->field($model, 'num')->textInput() ?>

    <?= $form->field($model, 'diff')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'index_img_url')->textInput() ?>
    <div id="imggg">
    <?php if (!$model->id){ ?>
    <a id="img" href="javascript:;" onClick="javascript:window.alert('请到修改处上传文件！')">添加图片</a>
    <?php  }else{ ?>
    <a id="img1" href="javascript:;" onClick="javascript:window.open('./?r=upload/qiniu&class=write_question-index_img_url-<?= $model->id ?>','','width=600,height=500,left=10, top=10,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;">修改图片</a>
    <?php  } ?>
    </div>
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
</div>
